<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>  
    <link rel="stylesheet" href="css/pintuer.css">
    <link rel="stylesheet" href="css/admin.css">
    <script src="js/jquery.js"></script>
    <script src="js/pintuer.js"></script>  
</head>
<body onload="queryData('');">
  <div class="panel-head"><strong class="icon-reorder"> 内容列表</strong></div>
    <div class="padding border-bottom">
      <ul class="search" style="padding-left:10px;">
        <li>
          <input type="text" placeholder="请输入订单编号" id="adcode" name="adcode" class="input" style="width:250px; line-height:17px;display:inline-block" />
          <a href="javascript:void(0)" class="button border-main icon-search" onclick="changesearch()" > 过滤</a>
          <a href="javascript:void(0)" class="button border-main icon-search" onclick="reset();" > 重置</a>
        </li>
        <li id="data_end">
        </li>
      </ul>
    </div>
    
    <table class="table table-hover text-center">
   	 
      <tr>
        <th width="10">ID</th> 
        <th width="25%">订单编号</th>       
        <th width="10%">是否启动</th>
        <th width="10%">今日排期量</th>
        <th width="10%">今日1+</th>
        <th width="10%">Redis准备数据量</th>
        <th width="120">开始时间</th>      
      </tr> 
      <tbody id="data_tb">	     
       
	  </tbody>
      
      
  
    </table>
<script type="text/javascript">

function queryData(adcode){
	$("#data_tb").empty();
	$("#data_end").empty();
	var url = "order/queryresult";
	$.ajax({
	    type: "get",
	    url: url,
	    data: "",
	    cache: false,
	    async : false,
	    dataType: "json",
	    success: function (data,textStatus){
	    	var array  = eval(data); 
	    	var todaytotal=0;
	    	if(adcode==""){
	  	        for(var i=0;i<array.length;i++){
	   	        	 var table1 = $("#data_tb");
	   	             var row = $("<tr></tr>");
	   	             var tda = $("<td>"+ (i+1) + "</td>");
	   	             var td0 = $("<td>"+ array[i].adcode + "</td>");
	   	             var td1 = $("<td>"+ array[i].isrun + "</td>");
	
	   	             var td3 = $("<td>"+ array[i].dayevt + "</td>");
	   	             var td4 = $("<td>"+ array[i].dayev1 + "</td>");
	   	          	 var td5 = $("<td>"+ array[i].expectsize + "</td>");
	   	             var td6 = $("<td>"+ array[i].starttime + "</td>");
	   	             row.append(tda);
	   	             row.append(td0);
	   	             row.append(td1);
	
	   	             row.append(td3);
	   	             row.append(td4);
	   	             row.append(td5);
	   	             row.append(td6);
	   	             table1.append(row);
	   	             todaytotal+=array[i].dayevt;
		        	 }
	  	         var tablet = $("#data_end");
	             var rowt = $("<tr colspan='4'></tr>");
	             var tdt0 = $("<td style='text-align: center;color:red'></td>");
	             var tdt1 = $("<td style='text-align: center;color:red'><strong>"+'今日需求：'+ array.length + "</strong>----</td>");
	             var tdt2 = $("<td style='text-align: center;color:red'><strong>"+'未执行：'+ array[0].unrun + "</strong>----</td>");
	             var tdt3 = $("<td style='text-align: center;color:red'><strong>"+' 已执行总量：'+ todaytotal/10000+ "万</strong></td>");
	             rowt.append(tdt0);
	             rowt.append(tdt1);
	             rowt.append(tdt2);
	             rowt.append(tdt3);
	             tablet.append(rowt); 
	    	}else{
	    		 for(var i=0;i<array.length;i++){
	    			 if(array[i].adcode==adcode){
		   	        	 var table1 = $("#data_tb");
		   	             var row = $("<tr></tr>");
		   	             var tda = $("<td>"+ (i+1) + "</td>");
		   	             var td0 = $("<td>"+ array[i].adcode + "</td>");
		   	             var td1 = $("<td>"+ array[i].isrun + "</td>");
		
		   	             var td3 = $("<td>"+ array[i].dayevt + "</td>");
		   	             var td4 = $("<td>"+ array[i].dayev1 + "</td>");
		   	          	 var td5 = $("<td>"+ array[i].expectsize + "</td>");
		   	             var td6 = $("<td>"+ array[i].starttime + "</td>");
		   	             row.append(tda);
		   	             row.append(td0);
		   	             row.append(td1);
		
		   	             row.append(td3);
		   	             row.append(td4);
		   	             row.append(td5);
		   	             row.append(td6);
		   	             table1.append(row);
		        	 }
	    		 }
	    	}
	    }
	 });
}
function changesearch(){
	var adcode = $("#adcode").val();
	if(adcode=="")
    {
		alert("请输入订单号...");
        return false;  // 返回false，a标签就会终止动作，不跳转
    }else{
		queryData(adcode);
    }
}
function reset(){
	$("#adcode").val("");
	queryData('');
}
</script>
</body></html>